package com.sky.mapper;

import com.sky.entity.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface OrderDetailMapper {

    /**
     * 批量删除订单详细信息
     * @param orderDetailList
     */
    void insertBatch(List<OrderDetail> orderDetailList);

    /**
     * 根据订单id查询订单信息表数据
     * @param ordersId
     * @return
     */
    @Select("select * from order_detail where order_id=#{orderId}")
    List<OrderDetail> getByOrderId(Long ordersId);

    /**
     * 一种菜品销量和
     * @param dishName
     * @param orderId
     * @return
     */
    @Select("select sum(number) from order_detail where name=#{dishName} and order_id=#{orderId} ")
    Integer getByDishName(String dishName, Long orderId);
}
